<template>
  <div class="container">
    <nav-bar subTitle="政策超市">
      <template #navBar>
        <bar-box :tableData="tableData"></bar-box>
      </template>
    </nav-bar>
    <div class="body">
      <div class="body-box" v-for="item in tableData" @click="navTo(item)">
        <el-image style="width: 100%;" :src="item.logo"></el-image>
        <div class="body-btns">{{ item.title }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import {ref} from "vue";
import {useRouter} from 'vue-router'
import NavBar from "@/components/navBar.vue";
import BarBox from "@/components/barBox.vue";
import {navData} from "./data/data.js"

const router = useRouter()


const tableData = ref(navData)
const navTo = (item) => {
  if(item.url){
    window.open(item.url)
  }else{
    router.push({path:item.path,query:{type:item.name}})
  }
}
</script>


<style scoped lang="scss">
.container {
  background: url('@/assets/images/home_bg.png') no-repeat center center / 100% 100%;
}

.body {
  height: calc(100vh - 50px);
  display: flex;
  justify-content: center;
  align-items: center;

  .body-box {
    width: 330px;
    height: 420px;
    margin: 0 20px;
    border-radius: 15px;
    border: 1px solid #2bb4f8;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 30px;
    text-align: center;

    .body-btns {
      cursor: pointer;
      margin-top: 20px;
      width: 100%;
      height: 66px;
      line-height: 66px;
      font-size: 26px;
      font-weight: 700;
      background: url('@/assets/images/btn_bg.png') no-repeat center center / 100% 100%;

      &:hover {
        filter: brightness(1.2);
      }

    }

  }
}

</style>
